﻿package view.popup
{
    import com.core.*;
    import com.sh.game.global.*;
    import flash.display.*;
    import flash.events.*;
    import flash.external.*;
    import manager.*;
    import morn.core.components.*;

    public class WeiDuanTiShi extends View implements IDialogUI
    {
        public var btn:Button;
        public var closeBtn:Button;
        protected var uiXML:XML;
        private var background:Sprite;

        public function WeiDuanTiShi()
        {
            this.uiXML = <View>r
n	t	t	t  <Image url=""png.common.s9_showdownbg"" x=""0"" y=""0"" width=""332"" height=""238"" sizeGrid=""70,30,70,40""/>r
n	t	t	t  <Image url=""jpg.wdxz.back"" x=""9"" y=""12"" width=""314"" height=""217""/>r
n	t	t	t  <Button skin=""png.wdxz.btn_xiazai"" x=""87"" y=""188"" var=""btn""/>r
n	t	t	t  <Button skin=""png.common.btn_close_normal"" x=""297"" y=""9"" var=""closeBtn""/>r
n	t	t	t</View>")("<View>
			  <Image url="png.common.s9_showdownbg" x="0" y="0" width="332" height="238" sizeGrid="70,30,70,40"/>
			  <Image url="jpg.wdxz.back" x="9" y="12" width="314" height="217"/>
			  <Button skin="png.wdxz.btn_xiazai" x="87" y="188" var="btn"/>
			  <Button skin="png.common.btn_close_normal" x="297" y="9" var="closeBtn"/>
			</View>;
            return;
        }// end function

        override protected function createChildren() : void
        {
            createView(this.uiXML);
            this.init();
            return;
        }// end function

        override protected function initialize() : void
        {
            super.initialize();
            return;
        }// end function

        private function init() : void
        {
            this.background = new Sprite();
            this.background.graphics.beginFill(0, 0.5);
            this.background.graphics.drawRect(0, 0, GlobalLayer.instance.root.stage.stageWidth, GlobalLayer.instance.root.stage.stageHeight);
            this.background.graphics.endFill();
            this.background.addEventListener(MouseEvent.MOUSE_DOWN, this.onDown);
            PluginManager.instance.alertContainer.addChild(this.background);
            var _loc_1:Boolean = false;
            this.visible = false;
            this.background.visible = _loc_1;
            this.x = GlobalLayer.instance.root.stage.stageWidth - this.width - 50;
            this.y = GlobalLayer.instance.root.stage.stageHeight - this.height - 100;
            this.addEventListener(MouseEvent.MOUSE_DOWN, this.onDown);
            GlobalLayer.instance.root.addEventListener(Event.RESIZE, this.resizeHandler);
            return;
        }// end function

        public function show(param1:Object) : void
        {
            var _loc_2:Boolean = true;
            this.visible = true;
            this.background.visible = _loc_2;
            this.btn.addEventListener(MouseEvent.CLICK, this.onXiazai);
            this.closeBtn.addEventListener(MouseEvent.CLICK, this.onClose);
            return;
        }// end function

        private function onXiazai(event:MouseEvent) : void
        {
            ExternalInterface.call("getMicroClient");
            ModelProxy.change("movetips", "error", "前往下载微端");
            this.close();
            return;
        }// end function

        private function onClose(event:MouseEvent) : void
        {
            this.close();
            return;
        }// end function

        public function close() : void
        {
            var _loc_1:Boolean = false;
            this.visible = false;
            this.background.visible = _loc_1;
            return;
        }// end function

        private function onDown(event:MouseEvent) : void
        {
            event.stopImmediatePropagation();
            return;
        }// end function

        private function resizeHandler(event:Event) : void
        {
            this.background.width = GlobalLayer.instance.root.stage.stageWidth;
            this.background.height = GlobalLayer.instance.root.stage.stageHeight;
            this.x = GlobalLayer.instance.root.stage.stageWidth - this.width - 50;
            this.y = GlobalLayer.instance.root.stage.stageHeight - this.height - 100;
            return;
        }// end function

    }
}
